package com.atguigu.gulimall.product.redis;

import org.junit.jupiter.api.Test;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

import java.util.UUID;

@SpringBootTest
public class RedisDemo {

    //@Resource是默认取字段名进行按照名称注
    @Autowired
    private StringRedisTemplate redisTemplate;

    @Test
    public void redisTest1() {
        ValueOperations<String, String> ops = redisTemplate.opsForValue();
        ops.set("hello", "world_" + UUID.randomUUID().toString());

        String hello = ops.get("hello");
        System.out.println(hello);


    }

    @Autowired
    RedissonClient redissonClient;

    @Test
    public void name() {
        System.out.println(redissonClient);
    }
}
